package edu.up.firesawakening;

import edu.up.game.GameAction;

/**
 * An action representing a move or attack
 * 
 * @author Alex Hanemann
 * @version 19 November 2012
 */
public abstract class TacticsAction extends GameAction {
	/**
	 * Serial ID
	 */
	private static final long serialVersionUID = -1856235731620703823L;

	/**
	 * tile that we're moving to
	 */
	protected Tile m_targetTile;

	/**
	 * tile that we're moving from
	 */
	protected Tile m_startTile;

	/**
	 * movement cost of going between these tiles
	 */
	protected int m_moveCost;

	/**
	 * For use by AI players
	 */
	protected double m_value;

	/**
	 * @param source
	 *            the index of the player that called the action
	 * @param startTile
	 *            the target tile of the action
	 * @param targetTile
	 *            the source tile of the action
	 */
	public TacticsAction(int source, Tile startTile, Tile targetTile, int cost) {
		super(source);
		m_targetTile = targetTile;
		m_startTile = startTile;
		m_moveCost = cost;
	}

	/**
	 * @return the value of this move
	 */
	public final double getValue() {
		return m_value;
	}

	/**
	 * @param d
	 *            value to set
	 */
	public final void setValue(double d) {
		m_value = d;
	}

	/**
	 * @return the tile to moving from
	 */
	public final Tile getStart() {
		return m_startTile;
	}

	/**
	 * @return x coord of start
	 */
	public final int getStartX() {
		return m_startTile.getX();
	}

	/**
	 * @return y coord of start
	 */
	public final int getStartY() {
		return m_startTile.getY();
	}

	/**
	 * @return x coord of target
	 */
	public final int getTargetX() {
		return m_targetTile.getX();
	}

	/**
	 * @return y coord of target
	 */
	public final int getTargetY() {
		return m_targetTile.getY();
	}

	/**
	 * @return the tile to move to
	 */
	public final Tile getTarget() {
		return m_targetTile;
	}

	/**
	 * @return the movement cost of this action
	 */
	public final int getMoveCost() {
		return m_moveCost;
	}

}
